import { osTenantId } from '@/config/app'
import { getProxyPath } from '../config/proxyPath'
import { createRequest } from '../utils/request'
import { Message } from 'element-ui'
const baseURL = getProxyPath('apiFile')
const request = createRequest({ baseURL, timeout: 30000 })
const request_download = createRequest(
  { baseURL, timeout: 30000, responseType: 'blob' },
  {
    responseBefore: function (response) {
      const res = response.data
      if (!res) {
        Message.error('下载失败')
        return Promise.reject(res)
      }
      return new Blob([res])
    }
  }
)

/**
 * 文件系统-龚
 */

/**上传文件 */
export function uploadFile(data) {
  
  return request.postFormData('/oss/uploadFile', data)
}
/**文件下载 */
export function downFile(id) {
  return request_download.get(`/oss/downloadFile?fid=${id}`, {})
}
/**文件文件详情 */
export function getFileInfo(fid) {
  return request.get(`/oss/getFileInfo?fid=${fid}`, {})
  
}
/**文件查看地址 */
export const readImgUrl = baseURL + '/oss/downloadFile?fid='
/**上传地址 */
export const uploadPath = baseURL + '/oss/upload'
